﻿#include "luaeditor.h"
#include <QFont>
LuaEditor::LuaEditor(QWidget *parent)
{
    initUI();
}

LuaEditor::~LuaEditor()
{

}

void LuaEditor::initUI()
{
    m_pLexer = QSharedPointer<QsciLexerLua>(new QsciLexerLua);

    setLexer(m_pLexer.data());

    m_pLexer->setPaper(QColor("#1D1E2E"));

    m_pLexer->setColor(QColor("#C94086"),QsciLexerLua::Keyword);

    m_pLexer->setColor(QColor("#2CADA8"),QsciLexerLua::Number);

    m_pLexer->setColor(QColor("#18CF09"),QsciLexerLua::Operator);

    m_pLexer->setColor(QColor("#E0DF4B"),QsciLexerLua::String);

    m_pLexer->setColor(QColor("#1B631D"),QsciLexerLua::Comment);
    m_pLexer->setColor(QColor("#1B631D"),QsciLexerLua::LineComment);

    m_pLexer->setColor(QColor(210,210,210),QsciLexerLua::Identifier);

    m_pLexer->setColor(QColor("#84A8F6"),QsciLexerLua::CoroutinesIOSystemFacilities);

    m_pLexer->setColor(QColor("#84A8F6"),QsciLexerLua::BasicFunctions);



    setWrapMode(QsciScintilla::WrapWord);
    setAutoCompletionSource(QsciScintilla::AcsAll);
    setAutoCompletionCaseSensitivity(false);
    setAutoCompletionThreshold(2);

    setFont(QFont("Consolas"));
    setMarginType(0, NumberMargin);

    setMarginWidth(0, 40);
    setAutoIndent(true);
    setUtf8(true);
    zoomTo(5);
    setCaretForegroundColor(QColor(255, 255, 255));

    setTabWidth(4);

    setAutoIndent(true);

    setCaretLineBackgroundColor(QColor("#E8E8FF"));

    setCaretWidth(2);
    setWrapIndentMode(QsciScintilla::WrapIndentFixed);
}
